import * as React from 'react';
import { Text, View, StyleSheet, SafeAreaView, Button } from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import { useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';

interface HomePageProps { }

const HomePage = (props: HomePageProps) => {
    const navigation = useNavigation();

    return (
        <SafeAreaView style = {styles.safeArea}>
            <View style={styles.container}>
                <Text>HomePage</Text>
                <Button title="Go to MyPage Now"   onPress={() => navigation.navigate('MyPage', { userId: 42, userName: 'James' })}
 />
            </View>
        </SafeAreaView>

    );
};

export default HomePage;

const styles = StyleSheet.create({
    safeArea: {
        flex: 1, // 让 SafeAreaView 占满全屏
      },
    container: {
        backgroundColor:Colors.grey,
        flex: 1,
        justifyContent: 'center',
        alignItems:'center',
    }
});
